package com.hunan.chinamobile.service.impl;

import com.hunan.chinamobile.dao.ExceptionsMapper;
import com.hunan.chinamobile.dto.ExceptionCount;
import com.hunan.chinamobile.dto.ExceptionDTO;
import com.hunan.chinamobile.model.Exceptions;
import com.hunan.chinamobile.service.ExceptionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ExceptionServiceImpl implements ExceptionService {

    @Resource
    private ExceptionsMapper exceptionsMapper;

    @Override
    public void save(Exceptions model) {
        exceptionsMapper.insert(model);
    }

    @Override
    public void deleteById(String id) {
        exceptionsMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(Exceptions model) {
        exceptionsMapper.updateByPrimaryKeySelective(model);
    }

    @Override
    public Exceptions findById(String id) {
        return exceptionsMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<ExceptionDTO> findList(String cityId, String bsId, Integer type, Integer state) {
        return exceptionsMapper.findList(cityId, bsId, type, state);
    }

    @Override
    public List<ExceptionDTO> findByQuery(String startTimeStr, String endTimeStr) {
        return exceptionsMapper.findByQuery(startTimeStr, endTimeStr);
    }

    @Override
    public List<ExceptionDTO> findByNotQuery(String dns, String startTimeStr) {
        return exceptionsMapper.findByNotQuery(dns, startTimeStr);
    }

    @Override
    public int countByCurrYear(String cityId) {
        return exceptionsMapper.countByCurrYear(cityId);
    }

    @Override
    public ExceptionCount countByCurrMonth(String cityId) {
        return exceptionsMapper.countByCurrMonth(cityId);
    }

    @Override
    public ExceptionCount countByUntreated(String cityId) {
        return exceptionsMapper.countByUntreated(cityId);
    }
}
